package com.faithbj.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.faithbj.common.model.fm.FamilyMember;
import com.faithbj.dao.FamilyMemberDao;
import com.faithbj.service.FamilyMemberService;

@Service("familyMemberService")
@Transactional
public class FamilyMemberServiceImpl implements FamilyMemberService {

	@Resource
	public FamilyMemberDao familyMemberDao;

	public Long getMemberNumOfFamily(String[] applyIds) {
		return familyMemberDao.getMemberNumByApplyIds(applyIds);
	}

	@Override
	public List<FamilyMember> getFamilyMembersByCheckTotal(String ctId) {
		return familyMemberDao.getFamilyMembersByCheckTotal(ctId);
	}

	@Override
	public FamilyMember getFamilyMemberById(String id) {
		return familyMemberDao.get(id);
	}

	@Override
	public void updateFamilyMember(FamilyMember fm) {
		familyMemberDao.update(fm);
	}
	@Override
	public void saveFamilyMember(FamilyMember fm) {
		familyMemberDao.save(fm);
	}

	@Override
	public void addFamilyMember(FamilyMember fm) {
		familyMemberDao.saveOrUpdate(fm);
	}

	@Override
	public void deleteFamilyMemberInfo(String id) {
		familyMemberDao.delete(id);
	}

	@Override
	public FamilyMember getByIdCardNumber(String id) {
		return familyMemberDao.get("idNumber", id);
	}
}
